/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
import { isArray } from 'lodash';
import type { ResponseReturned } from '@/utils/request';
import type { ListReqParams, ListItem } from '@/pages/Other/Cov19/cov19';

interface ListResponse {
  code: number;
  msg: string;
  data: ListItem[];
}

export async function getList(params: ListReqParams): Promise<any> {
  return request<ListResponse>('/Covid19/importOperateRecord', {
    method: 'POST',
    data: params,
  }).then(({ data = [] }) => {
    if (isArray(data) && data.length > 0) {
      return data;
    }
    return [];
  });
}

export async function importCov(params: any): Promise<any> {
  return request<ResponseReturned>('/Covid19/importCovid19Data', {
    method: 'POST',
    data: params,
  });
}
